package jacob;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

public class Mob_Arena_Wand extends ItemSword 
{

	public Mob_Arena_Wand(int par1, EnumToolMaterial par2EnumToolMaterial) 
	{
		super(par1, par2EnumToolMaterial);
		this.setCreativeTab(CreativeTabs.tabCombat);
		// TODO Auto-generated constructor stub
	}
	    
	
    public void registerIcons(IconRegister iconReg) 
    {
            itemIcon = iconReg.registerIcon("iDTechModBase:QuickBaseWand");
    }
   
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,EntityPlayer par3EntityPlayer) 
    {
        if (!par2World.isRemote)
        {
        	
            par3EntityPlayer.posY++;
            MovingObjectPosition coord = par3EntityPlayer.rayTrace(500, 1);
            if (coord != null)
            {
                            
                int height = 25;
                int length = 35;
                int depth = 35;
                coord.blockX -= length/2;
                coord.blockZ -= depth/2;   
                    
                for (int j = 0; j < length; j ++)
                {
                    for (int k = 0; k < depth; k ++)
                    {
                        
                    	par2World.setBlock((int)coord.blockX+j, (int)coord.blockY,(int) coord.blockZ+k, Block.glowStone.blockID);
                    }
                }
                        
                coord.blockY++;
                for (int i = 0;i < height;i++)
                {
                    for (int j = 0; j < length-1; j ++)
                    {
                            par2World.setBlock((int)coord.blockX++, (int)coord.blockY,(int) coord.blockZ, Block.planks.blockID);
                            
                    }
                    for (int k = 0; k < depth-1; k ++)
                    {
                            par2World.setBlock((int)coord.blockX, (int)coord.blockY,(int) coord.blockZ++, Block.planks.blockID);
                            
                    }
                    for (int l = 0; l < length-1; l ++)
                    {
                            par2World.setBlock((int)coord.blockX--, (int)coord.blockY,(int) coord.blockZ, Block.planks.blockID);
                            
                    }
                    for (int m = 0; m< depth-1; m ++)
                    {
                            par2World.setBlock((int)coord.blockX, (int)coord.blockY,(int) coord.blockZ--, Block.planks.blockID);
                            
                    }
                    coord.blockY++;
                }
                
                for (int j = 0; j < length; j ++)
                {
                    for (int k = 0; k < depth; k ++)
                    {
                        
                    	par2World.setBlock((int)coord.blockX+j, (int)coord.blockY,(int) coord.blockZ+k, Block.glass.blockID);
                    }
                }

                 /*   
                    
                for (int j = 0; j < length; j ++)
                {
                     par2World.setBlock((int)coord.blockX++, (int)coord.blockY+1,(int) coord.blockZ, Block.planks.blockID);
                        
                }
                for (int k = 0; k < length; k ++)
                {
                     par2World.setBlock((int)coord.blockX, (int)coord.blockY+1,(int) coord.blockZ++, Block.planks.blockID);
                        
                }
                for (int l = 0; l < length; l ++)
                {
                     par2World.setBlock((int)coord.blockX--, (int)coord.blockY+1,(int) coord.blockZ, Block.planks.blockID);
                        
                }
                for (int m = 0; m< length; m ++)
                {
                     par2World.setBlock((int)coord.blockX, (int)coord.blockY+1,(int) coord.blockZ--, Block.planks.blockID);
                        
                }
                
               
                for (int j = 0; j < length; j ++)
                {
                        par2World.setBlock((int)coord.blockX++, (int)coord.blockY+2,(int) coord.blockZ, Block.planks.blockID);
                        
                }
                for (int k = 0; k < length; k ++)
                {
                        par2World.setBlock((int)coord.blockX, (int)coord.blockY+2,(int) coord.blockZ++, Block.planks.blockID);
                        
                }
                for (int l = 0; l < length; l ++)
                {
                        par2World.setBlock((int)coord.blockX--, (int)coord.blockY+2,(int) coord.blockZ, Block.planks.blockID);
                        
                }
                for (int m = 0; m< length; m ++)
                {
                        par2World.setBlock((int)coord.blockX, (int)coord.blockY+2,(int) coord.blockZ--, Block.planks.blockID);
                        
                }
        
        
        
                for (int j = 0; j < length; j ++)
                {
                    par2World.setBlock((int)coord.blockX++, (int)coord.blockY+3,(int) coord.blockZ, Block.planks.blockID);
                        
                }
                for (int k = 0; k < length; k ++)
                {
                        par2World.setBlock((int)coord.blockX, (int)coord.blockY+3,(int) coord.blockZ++, Block.planks.blockID);
                        
                }
                for (int l = 0; l < length; l ++)
                {
                        par2World.setBlock((int)coord.blockX--, (int)coord.blockY+3,(int) coord.blockZ, Block.planks.blockID);
                        
                }
                for (int m = 0; m< length; m ++)
                {
                        par2World.setBlock((int)coord.blockX, (int)coord.blockY+3,(int) coord.blockZ--, Block.planks.blockID);
                        
                }
                   
                */
            }
           
	    }
        return par1ItemStack;  
    }        
}